package com.holly.unit.bpmn.designer.enums;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * 类描述: 超时事件 枚举类
 *
 * @author fxr
 * @version 1.0.0
 * @date 2022/5/7 9:51
 */
public enum TimeOutEventEnum {

    // 通过
    PASS("PASS"),
    // 拒绝
    REFUSE("REFUSE"),
    // 提醒
    NOTIFY("NOTIFY");

    String fieldName;

    TimeOutEventEnum(String fieldName) {
        this.fieldName = fieldName;
    }

    public String fieldName() {
        return this.fieldName;
    }

    public static TimeOutEventEnum of(String fieldName) {
        return Stream.of(TimeOutEventEnum.values())
                .filter(clazz -> Objects.equals(clazz.fieldName(), fieldName))
                .findFirst()
                .orElse(PASS);
    }

}
